The technology described herein relates to a method of and apparatus for approximating a function that maps input values to output values, particularly in the context of computer graphics processing.
As is known in the art, graphics processing is normally carried out by first dividing the output to be generated, such as a frame to be displayed, into a number of similar basic components (so-called “primitives”) to allow the graphics processing operations to be more easily carried out. These “primitives” are usually in the form of simple polygons, such as triangles.
The graphics primitives are usually generated by the applications program interface for the graphics processing system, using the graphics drawing instructions (requests) received from the application (e.g. game) that requires the graphics output.
Each primitive is at this stage usually defined by and represented as a set of vertices. Each vertex for a primitive has associated with it a set of data (such as position, colour, texture and other attributes data) representing the vertex. This data is then used, e.g., when rasterising and rendering the vertex (the primitive(s) to which the vertex relates) in order to generate the desired output of the graphics processing system.
Once primitives and their vertices have been generated and defined, they can be processed by the graphics processing system, in order, e.g., to display the frame.
This process basically involves determining which sampling points of an array of sampling points covering the output area to be processed are covered by a primitive, and then determining the appearance each sampling point should have (e.g. in terms of its colour, etc.) to represent the primitive at that sampling point. These processes are commonly referred to as rasterising and rendering, respectively.
(In graphics literature, the term “rasterisation” is sometimes used to mean both primitive conversion to sample positions and rendering. However, herein “rasterisation” will be used to refer to converting primitive data to sampling point addresses only.)
The rasterising process determines the sample positions that should be used for a primitive (i.e. the (x, y) positions of the sampling points to be used to represent the primitive in the output, e.g. scene to be displayed). This is typically done using the positions of the vertices of a primitive.
The rendering process then derives the data, such as red, green and blue (RGB) colour values and an “Alpha” (transparency) value, necessary to represent the primitive at the sampling points (i.e. “shades” each sampling point). This can involve, as is known in the art, applying textures, blending sampling point data values, etc.
The data which is used to represent the primitive at the sampling point may have one or more functions applied to it, e.g. so as to apply gamma correction and/or to store the data in a different (e.g. more efficient) format. However, applying functions to inputted data can sometimes be computationally expensive, particularly where division is to be carried out in order to implement the function. For this reason, it is known to apply approximations of functions to inputted data which are computationally more efficient than applying the true functions. However, an approximation of a function can introduce errors between the data outputted using the approximated function and data which would have been outputted had the true function been applied. Furthermore, further errors can be introduced if the inverse of the approximation of the function is then later applied to the outputted data so as to recover the inputted data. These errors can be compounded if the approximation of the function and then its inverse are repeatedly applied to the data.
The Applicants, therefore, believe that there remains scope for improved techniques for approximating functions in, inter alia, the context of computer graphics processing.
Like reference numerals are used for like components where appropriate in the drawings.